package com.zhj.interview;

/**
 * @author zhj
 */
public class Test08 {
    public static void main(String[] args) {
        System.out.println(uniquePaths(3, 5));
    }
    public static int uniquePaths(int m, int n) {
        int[][] res = new int[m][n];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                if (i == 0 || j == 0) {
                    res[i][j] = 1;
                } else {
                    res[i][j] = res[i-1][j] + res[i][j-1];
                }
            }
        }
        return res[m-1][n-1];
    }
}
